package com.itcv.resident.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.itcv.resident.entity.ResidentBusiness;
import com.itcv.resident.service.IResidentBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author baomidou
 * @since 2024-06-26
 */
@Controller
@RequestMapping("/resident/residentBusiness")
public class ResidentBusinessController {

    @Autowired
    private IResidentBusinessService residentBusinessService;

    @GetMapping
    @ResponseBody
    public IPage<ResidentBusiness> pageList(){
        return residentBusinessService.selectPageByWrapper();
    }
   @GetMapping("/{id}")
   @ResponseBody
    public ResidentBusiness getById(@PathVariable  Long id){
       System.out.println(id);
       ResidentBusiness residentBusiness  = residentBusinessService.getById(id);
       System.out.println(residentBusiness);
       return residentBusiness;
   }

    @GetMapping("/byName")
    @ResponseBody
    public IPage<ResidentBusiness> pageList( String name){
        return residentBusinessService.selectPageByAuto(name);
    }



}
